//
//  LDCLoginViewController.m
//  LaiKeDaoClient
//
//  Created by zouzhisheng on 15/10/4.
//  Copyright © 2015年 LKD. All rights reserved.
//

#import "LDCLoginViewController.h"
#import "LDCRegistViewController.h"

@interface LDCLoginViewController ()

-(IBAction)loginAction:(id)sender;
-(IBAction)registAction:(id)sender;

@end

@implementation LDCLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    UILabel *label1 = (UILabel*)[self.view viewWithTag:10];
    UILabel *label2 = (UILabel*)[self.view viewWithTag:11];
    UIButton *btn1 = (UIButton*)[self.view viewWithTag:12];
    
    label1.layer.borderColor = [UIColor lightGrayColor].CGColor;
    label1.layer.borderWidth = 0.5;
    label2.layer.borderColor = [UIColor lightGrayColor].CGColor;
    label2.layer.borderWidth = 0.5;
    
    btn1.layer.borderColor = [UIColor blueColor].CGColor;
    btn1.layer.borderWidth = 0.5;
}

-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBar.hidden = YES;
}

-(IBAction)loginAction:(id)sender{
    [CSHApiClient loginWithMobile:_mobileTF.text password:_passwordTF.text didFinishLoaded:^(KXJson *json, NSString *path) {
        if ([json getIntForKey:@"code"]==200) {
            KXJson *json1=[json getJsonForKey:@"data"];
            [[UserInfo SharedUserfo] setUser_token:[json1 getStringForKey:@"user_token"]];
            SharedAppDelegate.window.rootViewController = SharedAppDelegate.tabBarController;
            self.navigationController.navigationBar.hidden = NO;
        }
    } didFailLoaded:^(NSError *error, NSString *path) {
        
    }];
  
}

-(IBAction)registAction:(id)sender{
    LDCRegistViewController *pv = [LDCRegistViewController new];
    [self.navigationController pushViewController:pv animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
